[ContainerRegistry] Update to beta.2 API design#15109
Conversation
for `set*Properties()` methods.
- type alias for known architecture and operating systems. - orderby literals: "timeAsc" and "timeDesc"
Fix linting issue Update api review md file
xirzec
left a comment
There was a problem hiding this comment.
Some initial feedback on the api shapes
| ```ts | ||
|
|
||
| import * as coreClient from '@azure/core-client'; | ||
| import * as coreHttps from '@azure/core-rest-pipeline'; |
There was a problem hiding this comment.
did we intend to alias this as a group? I notice we directly import PipelineOptions below
There was a problem hiding this comment.
I believe these two are from the generated code and probably pulled in by api-extractor when we export generated types.
There was a problem hiding this comment.
Somehow it's gone in the latest version, after I removed export of a generated type.
| import { TokenCredential } from '@azure/core-auth'; | ||
|
|
||
| // @public | ||
| export type ArtifactArchitecture = "386" | "amd64" | "arm" | "arm64" | "mips" | "mipsle" | "mips64" | "mips64le" | "ppc64" | "ppc64le" | "riscv64" | "s390x" | "wasm" | string; |
There was a problem hiding this comment.
does this type provide value? TS will collapse this to type ArtifactArchitecture = string
There was a problem hiding this comment.
Right, I was thinking about making them extensible, but the generated code has export const enum KnownArtifactArchitecture which I don't think we like in TS.
There was a problem hiding this comment.
Changed to string, and export KnownArtifactArchitecture literal unions.
|
|
||
| // @public | ||
| export interface ArtifactManifestProperties { | ||
| readonly architecture?: ArtifactArchitecture | null; |
There was a problem hiding this comment.
what does null vs undefined mean? Does it remove the property at the source when doing a patch/update?
question applies to other nullable properties too
There was a problem hiding this comment.
These are output only. It's an error from copy-&-pasting the generated code.
| readonly operatingSystem?: ArtifactOperatingSystem | null; | ||
| readonly repositoryName?: string; | ||
| readonly size?: number; | ||
| readonly tags?: string[]; |
There was a problem hiding this comment.
can we make this default to an empty array similar to manifests?
| } | ||
|
|
||
| // @public | ||
| export type ArtifactOperatingSystem = "aix" | "android" | "darwin" | "dragonfly" | "freebsd" | "illumos" | "ios" | "js" | "linux" | "netbsd" | "openbsd" | "plan9" | "solaris" | "windows" | string; |
| getArtifact(repositoryName: string, tagOrDigest: string): RegistryArtifact; | ||
| getRepository(repositoryName: string): ContainerRepository; | ||
| listRepositoryNames(options?: ListRepositoriesOptions): PagedAsyncIterableIterator<string, string[]>; | ||
| loginServer: string; |
There was a problem hiding this comment.
this are public, mutable properties?
| export class ContainerRepositoryClient { | ||
| constructor(endpointUrl: string, repository: string, credential: TokenCredential, options?: ContainerRegistryClientOptions); | ||
| export class ContainerRepository { | ||
| // Warning: (ae-forgotten-export) The symbol "GeneratedClient" needs to be exported by the entry point index.d.ts |
There was a problem hiding this comment.
this feels a bit leaky, we should be able to avoid exposing GeneratedClient -- seems like this class should be hidden and we can expose a compatible ContainerRegistry interface that we return the class instance for
There was a problem hiding this comment.
Yes I will expose interface instead.
| readonly deletedManifests?: string[]; | ||
| readonly deletedTags?: string[]; |
There was a problem hiding this comment.
would be nice to default these arrays to empty array
| writeableProperties?: ContentProperties; | ||
| export class RegistryArtifact { | ||
| // @internal | ||
| constructor(registryUrl: string, repositoryName: string, tagOrDigest: string, client: GeneratedClient); |
There was a problem hiding this comment.
same thinking, let's make this an interface since it's not a Client
| constructor(registryUrl: string, repositoryName: string, tagOrDigest: string, client: GeneratedClient); | ||
| delete(options?: DeleteArtifactOptions): Promise<void>; | ||
| deleteTag(tag: string, options?: DeleteTagOptions): Promise<void>; | ||
| // (undocumented) |
xirzec
left a comment
There was a problem hiding this comment.
Reviewed notes + api shape and both look good to me modulo some comments. 👍
I didn't review changes to other files, so probably good to get one more reviewer signoff before merging.
| // @public | ||
| export interface ArtifactManifestProperties { | ||
| readonly architecture?: ArtifactArchitecture | null; | ||
| readonly architecture?: ArtifactArchitecture; |
There was a problem hiding this comment.
since this is just string now, can we make it string here instead of having to define a type that aliases string?
| readonly digest?: string; | ||
| readonly lastUpdatedOn?: Date; | ||
| manifests?: ArtifactManifestProperties[]; | ||
| readonly operatingSystem?: ArtifactOperatingSystem | null; |
Improve CHANGELOG Co-authored-by: Jeff Fisher <xirzec@xirzec.com>
| ? "timeasc" | ||
| : options.orderBy === "timeDesc" | ||
| ? "timedesc" | ||
| : undefined; |
There was a problem hiding this comment.
I wonder if toLowerCase would be better here. It's not really that relevant in itself, however: These constant values, would they change later? should we scope these transformations in some functions? so that the transformation changes happen separately from the logic changes?
Take it or leave it, I'm just sharing an idea 🌞
There was a problem hiding this comment.
Moved to a transformation helper function.
| } | ||
| if (currentPage.manifests) { | ||
| yield currentPage.manifests.map((t) => { | ||
| return { |
There was a problem hiding this comment.
In Key Vault we like to put translations like this (type A to type B) in a "transformations" file. What we find important is not the name of the file, but the idea of separating the renames from the logic around the renames. Sometimes these renames happen more than once, so these functions can be re-used. Here's one for KV Keys: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-keys/src/transformations.ts
There was a problem hiding this comment.
I extracted this into a helper function in transformation.ts
sadasant
left a comment
There was a problem hiding this comment.
Thank you Jeremy!, this is good work 👍
and address JS review feedback. API changes include
ContainerRegistryClientwith helper classes of hierarchyContainerRepository=>RegistryArtifactto group repository and artifact operationsSet*Properties()methodsloginServerandfullyQualifiedNamefor better interaction with docker and other tools.